package com.cby.user.test3D;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/*
**  Create by: 王孙康宏
    Date:2021-10-24
    Time:21:55
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Space implements Comparable<Space>{
    // 前左下角坐标
    float x1,y1,z1;
    // 后右上角坐标
    float x2,y2,z2;
    public Space(Space space){
        x1 = space.getX1();
        x2 = space.getX2();
        y1 = space.getY1();
        y2 = space.getY2();
        z1 = space.getZ1();
        z2 = space.getZ2();
    }
    @Override
    public int compareTo(Space o) {
        // 优先x小的
        if(x1<o.x1){
            return -1;
        }else if(x1>o.x1){
            return 1;
        }else{
            if(y1<o.y1){
                return -1;
            }else if(y1>o.y1){
                return 1;
            }else{
                if(z1<o.z1){
                    return -1;
                }else if(z1>o.z1){
                    return 1;
                }else{
                    return 0;
                }
            }
        }
    }
}
